package org.keyyond.ms.commonservice.dao;

import java.util.List;
import java.util.UUID;

import org.keyyond.ms.commonservice.mapper.SDBDUserRoleMapper;
import org.keyyond.ms.commonservice.model.SDBDUserRole;
import org.keyyond.ms.core.util.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SDBDUserRoleDao {
	
	@Autowired
	private SDBDUserRoleMapper userRoleMapper;

	public int deleteUserRolesByUserid(String seqno) {
		// TODO Auto-generated method stub
		return userRoleMapper.deleteUserRolesByUserid(seqno);
	}

	public int addUserRole(SDBDUserRole usereRole) {
		// TODO Auto-generated method stub
		usereRole.setSeqno(UUID.randomUUID().toString());
		usereRole.setCreateon(DateUtil.getTimestamp());
		usereRole.setModifyon(DateUtil.getTimestamp());
		return userRoleMapper.insert(usereRole);
	}

	public List<SDBDUserRole> getRolesByUserid(SDBDUserRole fur) {
		// TODO Auto-generated method stub
		return userRoleMapper.getRolesByUserid(fur);
	}

}
